#!/usr/bin/python3

import paramiko
import time
from datetime import datetime

ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh_client.connect(hostname="10.110.111.22", username="huawei", password="123456")

cmd = ssh_client.invoke_shell()

shijian = datetime.now()
newfile = "ar3_%s_%s_%s_%s_%s_vrpcfg.zip"%(shijian.year,shijian.month,shijian.day,shijian.hour,shijian.minute)
cmd.send("sys\n")
cmd.send("sftp 192.168.99.101\n")
time.sleep(1)
cmd.send("sshuser\n")
time.sleep(1)
cmd.send("y\n")
time.sleep(1)
cmd.send("y\n")
time.sleep(1)
cmd.send("123456\n")
time.sleep(1)
cmd.send("put vrpcfg.zip %s\n"%newfile)
time.sleep(2)
output = cmd.recv(10000)
print(output.decode("utf-8"))


ssh_client.close()